package com.pcbly.web.action.system;

import java.util.List;

import com.pcbly.web.action.BaseAction; 
import com.pcbly.web.bean.system.RoleBean;
import com.pcbly.web.business.role.RoleService;

public class RoleAction extends BaseAction<RoleBean> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2952179411258608322L;
	private RoleService roleService;
	private RoleBean roleBean;
	private List<RoleBean> roleBeans;
	public String index() throws Exception {
		roleBeans = roleService.findRoleBeans();
		return super.index();
	}

	public String dwrSave(RoleBean bean) throws Exception {
		if (bean.getId() == null || "".equals(bean.getId())) {
			roleService.saveRoleBean(bean);
		} else {
			roleService.updateRoleBean(bean);
		}
		return "ok";
	}

	public String dwrDelete(String id) throws Exception {
		roleService.deleteRoleBeanById(id);
		return "ok";
	}

	public RoleBean dwrView(String id) throws Exception {
		roleBean = roleService.getRoleBeanById(id);
		return roleBean;
	}
	public RoleBean getRoleBean() {
		return roleBean;
	}
	public void setRoleBean(RoleBean roleBean) {
		this.roleBean = roleBean;
	}
	public List<RoleBean> getRoleBeans() {
		return roleBeans;
	}
	public void setRoleBeans(List<RoleBean> roleBeans) {
		this.roleBeans = roleBeans;
	}
	public void setRoleService(RoleService roleService) {
		this.roleService = roleService;
	}
	
	

}
